
<!DOCTYPE html>
<html>
<head>
	<title>餐饮营销支持系统</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="../../css/bootstrap.min.css" rel="stylesheet">
	<!-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> -->
	<link rel="stylesheet" type="text/css" href="../../css/waiter.css">
</head>
<body>
	<div id="head">
		<div class="navbar navbar-default  navbar-inverse" role="navigation">
			<div class="navbar-header">
				<a href="##" class="navbar-brand">餐饮营销支持系统</a>
			</div>
			<!-- 	<a href="javascript:if(confirm('确定要推出登录吗?'))location='sign.html'"> -->
			<button type="submit" class="btn btn-danger">
				<span style="margin-right: 5px" class="glyphicon glyphicon-off"></span>注销
			</button>
			<!-- </a> -->
		</div>

	</div>
	
	<div id="left">

		<p class="left-head">
			boss登录</p>

			<div class="container">
				<div class="row" style="margin-top: 0px">
					<a href="./boss.html">
						<div class="col-md-12">
							<span class="glyphicon glyphicon-user"></span>
							<p>个人信息</p>
						</div>
					</a>
				</div>
				<div class="row">
					<a href="./boss-two.html">
						<div class="col-md-12">
							<span class="glyphicon glyphicon-home"></span>
							<p>店铺管理</p>
						</div>
					</a>
				</div>
				<div class="row">
					<a href="./boss-three.html">
						<div class="col-md-12">
							<span class="glyphicon glyphicon-plus-sign"></span>
							<p>店铺人员</p>
						</div>
					</a>
				</div>
				<div class="row act">

						<div class="col-md-12">
							<span class="glyphicon glyphicon-list"></span>
							<p>菜单管理</p>
						</div>
					
				</div>
				<div class="row">
					<a href="./boss-five.html">
						<div class="col-md-12">
							<span class="glyphicon glyphicon-retweet"></span>
							<p>收益比例</p>
						</div>
					</a>
				</div>

				<div class="row">
					<a href="./boss-six.html">
						<div class="col-md-12">
							<span class="glyphicon glyphicon-th"></span>
							<p>收入查询</p>
						</div>
					</a>
				</div>
			</div>
		</div>

		<div id="right">
			<div class="right-head">
				<ol class="breadcrumb">
					<li><a href="#">首页</a></li>
					<li><a href="./boss-four.html">菜单管理</a></li>
					<li class="active">菜单添加</li>
				</ol> 
			</div>
			<div class="con">

				<div class="container">
					
					<div class="row">
						<div class="col-md-12">
							<div class="panel panel-default">
								<div class="panel-body">
									<div class="row">
										<p class="from-top">
											菜单添加
										</p>
									</div>
									<form class="form-horizontal" method="get" data-validate="parsley">
										<div class="form-group">
											<label class="col-lg-3 control-label">
												选择地区：
											</label>
											<div class="col-lg-2">
												<select name="省" class="form-control" id = "provinces"> 
												</select>
											</div>
											<div class="col-lg-2">
												<select name="市" class="form-control" id = "citys"> 
												</select>
											</div>
											<div class="col-lg-2">
												<select name="县" class="form-control" id = "adress"> 
												</select>
											</div>
										</div>
										<div class="form-group">
											<label class="col-lg-3 control-label">
												菜名/分类：
											</label>
											<div class="col-lg-3">
												<input type="text" name="菜名" placeholder="请输入菜的名称" class="bg-focus form-control parsley-validated" id="foodname">
											</div>
											<div class="col-lg-3">
												<select name="分类" class="form-control" id="foodtype"> 
													<option value="1">炒菜</option>
													<option value="2">炖菜</option>
													<option value="3">涮菜</option>
													<option value="4">凉菜</option>
													<option value="5">主食</option>
													<option value="6">酒水</option>
													<option value="7">其他</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<label class="col-lg-3 control-label">
												口味/分量：
											</label>
											<div class="col-lg-3">
												<input type="text" name="口味" placeholder="请输入菜的口味" class="bg-focus form-control parsley-validated" id="foodflavor">
											</div>

											<div class="col-lg-3">
												<input type="text" name="分量" placeholder="请输入菜的分量" class="bg-focus form-control parsley-validated" id="foodweight">
											</div>
										</div>
										<div class="form-group">
											<label class="col-lg-3 control-label">
												单价（元）：
											</label>
											<div class="col-lg-3">
												<input type="text" name="整数" placeholder="菜价的整数部分" class="bg-focus form-control parsley-validated" id="foodprice1">
											</div>

											<div class="col-lg-3">
												<input type="text" name="小数" placeholder="菜价的小数部分" class="bg-focus form-control parsley-validated" id="foodprice2">
											</div>
										</div>
										<div class="form-group">
											<label class="col-lg-3 control-label">
												菜的描述：
											</label>
											<div class="col-lg-8">
												<textarea name="描述" class="form-control" rows="5" id="foodintro"></textarea>
											</div>
										</div>
										<div class="form-group">
											<div class="col-lg-2 col-lg-offset-5">
												<button class="btn btn-danger" type="reset">重 置</button>
												<button style="margin-left: 15px" class="btn btn-primary" type="button" id="menu-submit">提 交</button>  
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script src="../../js/Jquary/jquery-3.2.1.min.js"></script>
		<script src="../../js/Jquary/jquery.easyui.min.js"></script>
		<script src="../../js/bootstrap.min.js"></script>
		<script type="text/javascript" src="../../js/logout.js"></script>
		<script type="text/javascript" src="../../js/adress.js"></script>
		<script type="text/javascript">
			$(document).ready(function(){
				$("#menu-submit").click(function(){
					var adressid = $("#adress").val();
					if(adressid==-1){
						alert("无效的地区");
						return;
					}
					var foodname = $("#foodname").val();
					if(foodname==""){
						alert("请输入名称");
						return;
					}
					var foodtype = $("#foodtype").val();
					if(foodtype==""){
						alert("请选择类别");
						return;
					}
					var foodflavor = $("#foodflavor").val();
					if(foodflavor==""){
						alert("请填写口味");
						return;
					}
					var foodweight = $("#foodweight").val();
					if(foodweight==""){
						alert("请填写分量");
						return;
					}
					
					var foodprice1 = $("#foodprice1").val();
					if(foodprice1==""){
						alert("价格输入错误");
						return;
					}
					var foodprice = parseFloat(foodprice1 +"."+$("#foodprice2").val());
					if(isNaN(foodprice)){
						alert("价格输入错误");
						return;
					}
					
					var foodintro = $("#foodintro").val();
					
					addMenu(foodname,foodtype,foodflavor,foodweight,foodprice,foodintro,adressid);
					
				});
				
				getAdress();
				
			})
		</script>
		<script type="text/javascript">
			function addMenu(foodname,foodtype,foodflavor,foodweight,foodprice,foodintro,adressid){
				$.ajax({
					type:"get",
					url:"/ldss/menus/addmenu",
					async:false,
					data:{
						foodname:foodname,
						foodtype:foodtype,
						foodflavor:foodflavor,
						foodweight:foodweight,
						foodprice:foodprice,
						foodintroduction:foodintro,
						serviceadressid:adressid
					},
					dataType:"json",
					success: function (data) {
						if(data.success){
							var data = data;
							alert("添加成功");
							window.location.href="./boss-four.html";
						}else{
							alert(data.message);
						}
					}
				});
			}
		</script>
	</body>
	</html>